package com.jindy.module.oacopyconfig.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.jindy.module.oacopyconfig.domain.SyOaCopyConfig;
import com.jindy.module.oacopyconfig.service.ISyOaCopyConfigService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jindy.common.annotation.Log;
import com.jindy.common.core.controller.BaseController;
import com.jindy.common.core.domain.AjaxResult;
import com.jindy.common.enums.BusinessType;
import com.jindy.common.utils.poi.ExcelUtil;
import com.jindy.common.core.page.TableDataInfo;

/**
 * 抄送配置Controller
 * 
 * @author jindy
 * @date 2023-05-11
 */
@RestController
@RequestMapping("/activiti/OaCopyConfig")
public class SyOaCopyConfigController extends BaseController
{
    @Autowired
    private ISyOaCopyConfigService syOaCopyConfigService;

    /**
     * 查询抄送配置列表
     */
    @PreAuthorize("@ss.hasPermi('activiti:OaCopyConfig:list')")
    @GetMapping("/list")
    public TableDataInfo list(SyOaCopyConfig syOaCopyConfig)
    {
        startPage();
        List<SyOaCopyConfig> list = syOaCopyConfigService.selectSyOaCopyConfigList(syOaCopyConfig);
        return getDataTable(list);
    }

    /**
     * 导出抄送配置列表
     */
    @PreAuthorize("@ss.hasPermi('activiti:OaCopyConfig:export')")
    @Log(title = "抄送配置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SyOaCopyConfig syOaCopyConfig)
    {
        List<SyOaCopyConfig> list = syOaCopyConfigService.selectSyOaCopyConfigList(syOaCopyConfig);
        ExcelUtil<SyOaCopyConfig> util = new ExcelUtil<SyOaCopyConfig>(SyOaCopyConfig.class);
        util.exportExcel(response, list, "抄送配置数据");
    }

    /**
     * 获取抄送配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('activiti:OaCopyConfig:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(syOaCopyConfigService.selectSyOaCopyConfigById(id));
    }

    /**
     * 新增抄送配置
     */
    @PreAuthorize("@ss.hasPermi('activiti:OaCopyConfig:add')")
    @Log(title = "抄送配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SyOaCopyConfig syOaCopyConfig)
    {
        return toAjax(syOaCopyConfigService.insertSyOaCopyConfig(syOaCopyConfig));
    }

    /**
     * 修改抄送配置
     */
    @PreAuthorize("@ss.hasPermi('activiti:OaCopyConfig:edit')")
    @Log(title = "抄送配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SyOaCopyConfig syOaCopyConfig)
    {
        return toAjax(syOaCopyConfigService.updateSyOaCopyConfig(syOaCopyConfig));
    }

    /**
     * 删除抄送配置
     */
    @PreAuthorize("@ss.hasPermi('activiti:OaCopyConfig:remove')")
    @Log(title = "抄送配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(syOaCopyConfigService.deleteSyOaCopyConfigByIds(ids));
    }
}
